class SessionsController < ApplicationController
  def create
    self.current_user = User.authenticate(params[:login_form], params[:password])
    if logged_in?
      redirect_to dashboards_path
      flash[:notice] = "Logged in successfully"
    else
			flash[:notice] = "Login failed"
      redirect_to home_path
    end
  end

  def destroy
    self.current_user.forget_me if logged_in?
    cookies.delete :auth_token
    reset_session
    flash[:notice] = "Logged out"
    redirect_to home_path
  end
end